package cn.yuanqiao.activiti.listener;

import cn.yuanqiao.archive.danganzhengli.service.IHandOverReceiveService;
import cn.yuanqiao.common.core.domain.R;
import cn.yuanqiao.common.exception.activiti.ArchiveProcessException;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @ClassName: WritsArchiveBorrowListener
 * @Description: 类的描述
 * @author: lihuahua
 * @date: 2023/6/5 19:24
 * @Blog: huahuacoco.top
 */

@Component("ArchiveHandOverNotAgreeListener")
public class ArchiveHandOverNotAgreeListener implements ExecutionListener {

    @Resource
    private IHandOverReceiveService iHandOverReceiveService;

    @Override
    public void notify(DelegateExecution execution) {
        Object handOverDataObj = execution.getVariable("processVariables");

        if (handOverDataObj == null){
            throw new ArchiveProcessException("借阅单数据不能为空");
        }
        Map<String,Object> handOverData = (Map<String, Object>) handOverDataObj;
        Integer id = iHandOverReceiveService.killHOV(Long.valueOf(handOverData.get("id").toString()));
        System.out.println("这里是移交不同意的节点");

    }
}
